package com.zking.service;

import com.zking.dao.StudentDao;
import com.zking.dao.TeacherDao;
import com.zking.entity.PageManager;
import com.zking.entity.Student;
import com.zking.entity.Teacher;

import java.util.List;

/**
 * 处理老师端的业务逻辑
 */
public class TeacherService {

  private TeacherDao TeaDao = new TeacherDao();

  /**
   * 获取老师总数据
   * @return
   */
  public int getTeacherTotal(){
    return TeaDao.getTeacherTotal();
  }

  /**
   * 分页老师数据
   * @param pm
   * @return
   */
  public List<Teacher> queryTeachers(PageManager pm){
    return TeaDao.queryTeacher(pm);
  }

  /**
   * 判断是否添加成功
   * @param t
   * @return
   */
  public boolean addTea(Teacher t){
    return TeaDao.addTea(t) >0;
  }

  /**
   * 删除老师用户
   * @param id
   * @return
   */
  public boolean delTea(int id){
    return TeaDao.delTea(id) > 0;
  }

  /**
   * 查询一个用户的数据
   * @param id
   * @return
   */
  public Teacher queryTea(int id){
    return TeaDao.queryTea(id);
  }

  /**
   * 用户自己更改除了消费金额和积分以外的信息
   * @param t
   * @return
   */
  public boolean updateTea(Teacher t){
    return  TeaDao.updateTea(t) > 0;
  }

}
